//
// Copyright 2019 ZetaSQL Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

// The file functions_testlib.cc has been split into multiple files prefixed
// with "functions_testlib_" because an optimized compile with ASAN of the
// original single file timed out at 900 seconds.

#include <string>
#include <vector>

#include "zetasql/testing/test_function.h"
#include "zetasql/testing/using_test_value.cc"  // NOLINT
#include "absl/status/status.h"
#include "absl/strings/string_view.h"
#include "absl/strings/substitute.h"

namespace zetasql {
namespace {
constexpr absl::StatusCode OUT_OF_RANGE = absl::StatusCode::kOutOfRange;
}  // namespace

static std::string Zeros(absl::string_view fmt, int zeros) {
  return absl::Substitute(fmt, std::string(zeros, '0'));
}

std::vector<FunctionTestCall> GetFunctionTestsFormatIntegral() {
  return std::vector<FunctionTestCall>({
      // Decimal values.
      {"format", {"%d", 5}, "5"},
      {"format", {"%3d", 5}, "  5"},
      {"format", {"%.3d", 5}, "005"},
      {"format", {"%5.3d", 5}, "  005"},
      {"format", {"%+5.3d", 5}, " +005"},
      {"format", {"%03d", 5}, "005"},
      {"format", {"%0.3d", 5}, "005"},
      {"format", {"%-3d", 5}, "5  "},
      {"format", {"%+3d", 6}, " +6"},
      {"format", {"%+-3d", 5}, "+5 "},
      {"format", {"%-03d", 5}, "5  "},
      {"format", {"%+03d", 5}, "+05"},

      {"format", {"%d", -5}, "-5"},
      {"format", {"%3d", -5}, " -5"},
      {"format", {"%03d", -5}, "-05"},
      {"format", {"%-03d", -5}, "-5 "},
      {"format", {"%+03d", -5}, "-05"},
      {"format", {"%5.3d", -5}, " -005"},

      {"format", {"%5.*d", 3, -5}, " -005"},
      {"format", {"%*.3d", 5, -5}, " -005"},
      {"format", {"%*.*d", 5, 3, -5}, " -005"},
      {"format", {"%*.*d", 5, -3, -5}, "   -5"},
      {"format", {"%*.*d", -5, 3, -5}, "-005 "},
      {"format", {"%*.*d", -5, -3, -5}, "-5   "},

      // Unsigned inputs with sign character flags.
      // These are repros for b/35036100.
      {"format", {"% d", Uint32(123)}, " 123"},
      {"format", {"%+d", Uint32(123)}, "+123"},
      {"format", {"%+4d", Uint32(123)}, "+123"},
      {"format", {"% 04d", Uint32(123)}, " 123"},
      {"format", {"%+04d", Uint32(123)}, "+123"},
      {"format", {"% .4d", Uint32(123)}, " 0123"},
      {"format", {"%+.4d", Uint32(123)}, "+0123"},
      {"format", {"%+5d", Uint32(123)}, " +123"},
      {"format", {"% 05d", Uint32(123)}, " 0123"},
      {"format", {"%+05d", Uint32(123)}, "+0123"},
      {"format", {"%- d", Uint32(123)}, " 123"},
      {"format", {"%-+d", Uint32(123)}, "+123"},
      {"format", {"%- 4d", Uint32(123)}, " 123"},
      {"format", {"%-+4d", Uint32(123)}, "+123"},
      {"format", {"%- .4d", Uint32(123)}, " 0123"},
      {"format", {"%-+.4d", Uint32(123)}, "+0123"},
      {"format", {"%- 5d", Uint32(123)}, " 123 "},
      {"format", {"%-+5d", Uint32(123)}, "+123 "},
      {"format", {"%-+6.4d", Uint32(123)}, "+0123 "},
      {"format", {"%+6.4d", Uint32(123)}, " +0123"},
      {"format", {"%+06.4d", Uint32(123)}, " +0123"},

      // More unsigned inputs with sign character flags with dynamic widths
      // and precisions
      {"format", {"%+*d", 4, Uint32(123)}, "+123"},
      {"format", {"% 0*d", 4, Uint32(123)}, " 123"},
      {"format", {"%+0*d", 4, Uint32(123)}, "+123"},
      {"format", {"% .*d", 4, Uint32(123)}, " 0123"},
      {"format", {"%+.*d", 4, Uint32(123)}, "+0123"},
      {"format", {"%+*d", 5, Uint32(123)}, " +123"},
      {"format", {"% 0*d", 5, Uint32(123)}, " 0123"},
      {"format", {"%+0*d", 5, Uint32(123)}, "+0123"},
      {"format", {"%- *d", 4, Uint32(123)}, " 123"},
      {"format", {"%-+*d", 4, Uint32(123)}, "+123"},
      {"format", {"%- .*d", 4, Uint32(123)}, " 0123"},
      {"format", {"%-+.*d", 4, Uint32(123)}, "+0123"},
      {"format", {"%- *d", 5, Uint32(123)}, " 123 "},
      {"format", {"%-+*d", 5, Uint32(123)}, "+123 "},
      {"format", {"%-+*.*d", 6, 4, Uint32(123)}, "+0123 "},
      {"format", {"%+*.*d", 6, 4, Uint32(123)}, " +0123"},
      {"format", {"%+0*.*d", 6, 4, Uint32(123)}, " +0123"},

      // Both signed an unsigned zeros will produce a + sign.
      {"format", {"%+d", Uint32(0)}, "+0"},
      {"format", {"%+d", Int32(0)}, "+0"},

      // Zero padding for widths greater than 140 characters. These cases are
      // subject to a limitation of third_part/fmt libraries which only respects
      // widths up to 136 characters when a number is zero padded.
      {"format", {"%0150u", Uint64(123)}, Zeros("$0123", 150 - 3)},
      {"format", {"%0150d", Int64(123)}, Zeros("$0123", 150 - 3)},
      {"format", {"%0150d", Int64(-123)}, Zeros("-$0123", 150 - 4)},
      {"format", {"%+0150d", Int64(123)}, Zeros("+$0123", 150 - 4)},
      {"format", {"%+0150d", Int64(-123)}, Zeros("-$0123", 150 - 4)},
      {"format", {"%0 150d", Int64(123)}, Zeros(" $0123", 150 - 4)},
      {"format", {"%0 150d", Int64(-123)}, Zeros("-$0123", 150 - 4)},
      {"format", {"%0150x", Int64(123)}, Zeros("$07b", 150 - 2)},
      {"format", {"%0150x", Int64(-123)}, Zeros("-$07b", 150 - 3)},
      {"format", {"%+0150x", Int64(123)}, Zeros("+$07b", 150 - 3)},
      {"format", {"% 0150x", Int64(123)}, Zeros(" $07b", 150 - 3)},
      {"format", {"%0#150x", Int64(123)}, Zeros("0x$07b", 150 - 4)},
      {"format", {"%0#150x", Int64(-123)}, Zeros("-0x$07b", 150 - 5)},
      {"format", {"%+0#150x", Int64(123)}, Zeros("+0x$07b", 150 - 5)},
      {"format", {"% 0#150x", Int64(123)}, Zeros(" 0x$07b", 150 - 5)},
      {"format", {"%0150o", Int64(123)}, Zeros("$0173", 150 - 3)},
      {"format", {"%0150o", Int64(-123)}, Zeros("-$0173", 150 - 4)},
      {"format", {"%+0150o", Int64(123)}, Zeros("+$0173", 150 - 4)},
      {"format", {"% 0150o", Int64(123)}, Zeros(" $0173", 150 - 4)},
      // Repeats the block above without negative cases for unsigned types.
      {"format", {"%0150d", Uint64(123)}, Zeros("$0123", 150 - 3)},
      {"format", {"%+0150d", Uint64(123)}, Zeros("+$0123", 150 - 4)},
      {"format", {"%0 150d", Uint64(123)}, Zeros(" $0123", 150 - 4)},
      {"format", {"%0150x", Uint64(123)}, Zeros("$07b", 150 - 2)},
      {"format", {"%+0150x", Uint64(123)}, Zeros("+$07b", 150 - 3)},
      {"format", {"% 0150x", Uint64(123)}, Zeros(" $07b", 150 - 3)},
      {"format", {"%0#150x", Uint64(123)}, Zeros("0x$07b", 150 - 4)},
      {"format", {"%+0#150x", Uint64(123)}, Zeros("+0x$07b", 150 - 5)},
      {"format", {"% 0#150x", Uint64(123)}, Zeros(" 0x$07b", 150 - 5)},
      {"format", {"%0150o", Uint64(123)}, Zeros("$0173", 150 - 3)},
      {"format", {"%+0150o", Uint64(123)}, Zeros("+$0173", 150 - 4)},
      {"format", {"% 0150o", Uint64(123)}, Zeros(" $0173", 150 - 4)},
      // Some cases to show zero padding and grouping working together
      {"format", {"%'015d", Int64(1234567)}, "0000001,234,567"},
      {"format", {"%'015x", Int64(1234567)}, "0000000012:d687"},
      {"format", {"%'015o", Int64(1234567)}, "0000000455,3207"},
      {"format", {"%'#015d", Uint64(1234567)}, "0000001,234,567"},
      {"format", {"%'#015x", Uint64(1234567)}, "0x00000012:d687"},
      {"format", {"%'#015o", Uint64(1234567)}, "0000000455,3207"},

      // With apostrophe
      {"format", {"%'d", 1}, "1"},
      {"format", {"%'d", -1}, "-1"},
      {"format", {"%'d", 21}, "21"},
      {"format", {"%'d", -21}, "-21"},
      {"format", {"%'d", 321}, "321"},
      {"format", {"%'d", -321}, "-321"},
      {"format", {"%'d", 4321}, "4,321"},
      {"format", {"%'d", -4321}, "-4,321"},
      {"format", {"%'d", 54321}, "54,321"},
      {"format", {"%'d", -54321}, "-54,321"},
      {"format", {"%'d", 987654321}, "987,654,321"},
      {"format", {"%'d", -987654321}, "-987,654,321"},
      {"format", {"%'7d", 54321}, " 54,321"},
      // TODO: Enable these test cases.
      // {"format", {"%'.7d", 54321}, "0,054,321"},
      // {"format", {"%'9.7d", 54321}, "0,054,321"},
      // {"format", {"%'+9.7d", 54321}, "+0,054,321"},
      {"format", {"%'03d", 54321}, "54,321"},
      // TODO: Enable this test case.
      // {"format", {"%'0.7d", 54321}, "0,054,321"},
      {"format", {"%'-3d", 54321}, "54,321"},
      {"format", {"%'+3d", 54321}, "+54,321"},
      {"format", {"%'+-3d", 54321}, "+54,321"},
      {"format", {"%'+-3d", -54321}, "-54,321"},
      {"format", {"%'-08d", 54321}, "54,321  "},

      // Per IEEE Std 1003.1, grouping is applied before zero padding.
      {"format", {"%'+09d", 54321}, "+0054,321"},

      // %d won't truncate the values.
      {"format", {"%d", 12345}, "12345"},
      {"format", {"%2d", 12345}, "12345"},
      {"format", {"%*d", 2, 12345}, "12345"},
      {"format", {"%2d", -12345}, "-12345"},
      {"format", {"%*d", 2, -12345}, "-12345"},
      {"format", {"%.2d", 12345}, "12345"},
      {"format", {"%.*d", 2, 12345}, "12345"},
      {"format", {"%.2d", -12345}, "-12345"},
      {"format", {"%.*d", 2, -12345}, "-12345"},

      // Maximal integer values.
      {"format",
       {"%d", Int64(std::numeric_limits<int64_t>::max())},
       "9223372036854775807"},
      {"format",
       {"%d", Int64(std::numeric_limits<int64_t>::lowest())},
       "-9223372036854775808"},
      {"format",
       {"%d", Uint64(std::numeric_limits<uint64_t>::max())},
       "18446744073709551615"},
      {"format",
       {"%i", Int64(std::numeric_limits<int64_t>::max())},
       "9223372036854775807"},
      {"format",
       {"%i", Int64(std::numeric_limits<int64_t>::lowest())},
       "-9223372036854775808"},
      {"format",
       {"%i", Uint64(std::numeric_limits<uint64_t>::max())},
       "18446744073709551615"},
      {"format",
       {"%x", Int64(std::numeric_limits<int64_t>::max())},
       "7fffffffffffffff"},
      {"format",
       {"%#X", Int64(std::numeric_limits<int64_t>::max())},
       "0X7FFFFFFFFFFFFFFF"},
      {"format",
       {"%o", Int64(std::numeric_limits<int64_t>::max())},
       "777777777777777777777"},
      {"format",
       {"%d", Uint64(std::numeric_limits<uint64_t>::max())},
       "18446744073709551615"},
      {"format",
       {"%i", Uint64(std::numeric_limits<uint64_t>::max())},
       "18446744073709551615"},
      {"format",
       {"%u", Uint64(std::numeric_limits<uint64_t>::max())},
       "18446744073709551615"},
      {"format",
       {"%u", Uint64(std::numeric_limits<uint64_t>::max())},
       "18446744073709551615"},
      {"format",
       {"%x", Uint64(std::numeric_limits<uint64_t>::max())},
       "ffffffffffffffff"},
      {"format",
       {"%#X", Uint64(std::numeric_limits<uint64_t>::max())},
       "0XFFFFFFFFFFFFFFFF"},
      {"format",
       {"%o", Uint64(std::numeric_limits<uint64_t>::max())},
       "1777777777777777777777"},
      // With apostrophe.
      {"format",
       {"%'d", Int64(std::numeric_limits<int64_t>::max())},
       "9,223,372,036,854,775,807"},
      {"format",
       {"%'d", Int64(std::numeric_limits<int64_t>::lowest())},
       "-9,223,372,036,854,775,808"},
      {"format",
       {"%'x", Int64(std::numeric_limits<int64_t>::max())},
       "7fff:ffff:ffff:ffff"},
      {"format",
       {"%'X", Int64(std::numeric_limits<int64_t>::max())},
       "7FFF:FFFF:FFFF:FFFF"},
      {"format",
       {"%'#X", Int64(std::numeric_limits<int64_t>::max())},
       "0X7FFF:FFFF:FFFF:FFFF"},
      {"format",
       {"%'o", Int64(std::numeric_limits<int64_t>::max())},
       "7,7777,7777,7777,7777,7777"},
      {"format",
       {"%'x", Uint64(std::numeric_limits<uint64_t>::max())},
       "ffff:ffff:ffff:ffff"},
      {"format",
       {"%'X", Uint64(std::numeric_limits<uint64_t>::max())},
       "FFFF:FFFF:FFFF:FFFF"},
      {"format",
       {"%'#X", Uint64(std::numeric_limits<uint64_t>::max())},
       "0XFFFF:FFFF:FFFF:FFFF"},
      {"format",
       {"%'o", Uint64(std::numeric_limits<uint64_t>::max())},
       "17,7777,7777,7777,7777,7777"},

      // Hex numbers.
      {"format", {"%x", Uint64(0)}, "0"},
      {"format", {"%x", Uint64(106)}, "6a"},
      {"format", {"%#x", Uint64(106)}, "0x6a"},
      {"format", {"%X", Uint64(106)}, "6A"},
      {"format", {"%#X", Uint64(106)}, "0X6A"},
      {"format", {"%x", Uint64(0x123456789abcdef)}, "123456789abcdef"},
      {"format", {"%x", Uint32(0x123abc)}, "123abc"},
      {"format", {"%#X", Uint32(0x123abc)}, "0X123ABC"},
      {"format", {"%.4X", Uint32(1)}, "0001"},
      {"format", {"%#.4X", Uint32(1)}, "0X0001"},
      {"format", {"%8.4X", Uint32(1)}, "    0001"},
      {"format", {"%#8.4X", Uint32(1)}, "  0X0001"},
      {"format", {"%#*.*X", 8, 4, Uint32(1)}, "  0X0001"},
      {"format", {"%#-8.4X", Uint32(1)}, "0X0001  "},
      {"format", {"%#-8.4X", Int32(1)}, "0X0001  "},
      // With apostrophe.
      {"format", {"%'x", Uint64(0x123456789abcdef)}, "123:4567:89ab:cdef"},
      {"format", {"%'x", Uint32(0x123abc)}, "12:3abc"},
      {"format", {"%'#X", Uint32(0x123abc)}, "0X12:3ABC"},
      {"format", {"%'.5X", Uint32(1)}, "0:0001"},
      {"format", {"%'#.5X", Uint32(1)}, "0X0:0001"},
      {"format", {"%'8.5X", Uint32(1)}, "  0:0001"},
      {"format", {"%'#9.5X", Uint32(1)}, " 0X0:0001"},
      {"format", {"%'#*.*X", 9, 5, Uint32(1)}, " 0X0:0001"},
      {"format", {"%'#-9.5X", Uint32(1)}, "0X0:0001 "},
      {"format", {"%'#-9.5X", Int32(1)}, "0X0:0001 "},

      // Octal numbers.
      {"format", {"%o", Uint64(0)}, "0"},
      {"format", {"%o", Uint64(55)}, "67"},
      {"format", {"%#o", Uint64(55)}, "067"},
      {"format", {"%6.4o", Uint64(55)}, "  0067"},
      {"format", {"%-6.4o", Uint64(55)}, "0067  "},
      {"format", {"%-#6.4o", Uint64(55)}, "0067  "},
      {"format", {"%-#6.3o", Uint64(55)}, "067   "},
      {"format", {"%-#6.2o", Uint64(55)}, "067   "},
      {"format", {"%-#6.0o", Uint64(55)}, "067   "},
      {"format", {"%-6.0o", Uint64(55)}, "67    "},
      {"format", {"%+o", Uint64(55)}, "+67"},
      {"format", {"%-6.0o", Int64(55)}, "67    "},
      // With apostrophe.
      {"format", {"%'o", Uint64(0)}, "0"},
      {"format", {"%'o", Uint64(55555)}, "15,4403"},
      {"format", {"%'#o", Uint64(55555)}, "015,4403"},
      {"format", {"%'10.6o", Uint64(55555)}, "   15,4403"},
      {"format", {"%'-#9.6o", Uint64(55555)}, "015,4403 "},
      {"format", {"%'-#9.3o", Uint64(55555)}, "015,4403 "},
      {"format", {"%'-#9.2o", Uint64(55555)}, "015,4403 "},
      {"format", {"%'-#9.0o", Uint64(55555)}, "015,4403 "},
      {"format", {"%'-9.0o", Uint64(55555)}, "15,4403  "},
      {"format", {"%'+o", Uint64(55555)}, "+15,4403"},
      {"format", {"%'+o", Int64(55555)}, "+15,4403"},

      // Hex and octal cases with signed types
      {"format", {"%+x", Int32(30)}, "+1e"},
      {"format", {"%+x", Int64(30)}, "+1e"},
      {"format", {"%+x", Int32(-30)}, "-1e"},
      {"format", {"%+x", Int64(-30)}, "-1e"},
      {"format", {"% x", Int32(30)}, " 1e"},
      {"format", {"% x", Int64(30)}, " 1e"},
      {"format", {"% x", Int32(-30)}, "-1e"},
      {"format", {"% x", Int64(-30)}, "-1e"},
      {"format", {"%+#x", Int64(30)}, "+0x1e"},
      {"format", {"%+#x", Int64(-30)}, "-0x1e"},
      {"format", {"% #x", Int64(30)}, " 0x1e"},
      {"format", {"% #x", Int64(-30)}, "-0x1e"},
      {"format", {"%+#X", Int64(30)}, "+0X1E"},
      {"format", {"%+#X", Int64(-30)}, "-0X1E"},
      {"format", {"% #X", Int64(30)}, " 0X1E"},
      {"format", {"% #X", Int64(-30)}, "-0X1E"},
      {"format", {"%+o", Int32(30)}, "+36"},
      {"format", {"%+o", Int64(30)}, "+36"},
      {"format", {"%+o", Int32(-30)}, "-36"},
      {"format", {"%+o", Int64(-30)}, "-36"},
      {"format", {"% o", Int32(30)}, " 36"},
      {"format", {"% o", Int64(30)}, " 36"},
      {"format", {"% o", Int32(-30)}, "-36"},
      {"format", {"% o", Int64(-30)}, "-36"},
      {"format", {"%+#o", Int64(30)}, "+036"},
      {"format", {"%+#o", Int64(-30)}, "-036"},
      {"format", {"% #o", Int64(30)}, " 036"},
      {"format", {"% #o", Int64(-30)}, "-036"},
      {"format", {"%+#10x", Int64(30)}, "     +0x1e"},
      {"format", {"%+#10x", Int64(-30)}, "     -0x1e"},
      {"format", {"%+#10o", Int64(30)}, "      +036"},
      {"format", {"%+#10o", Int64(-30)}, "      -036"},
      {"format", {"% #10x", Int64(30)}, "      0x1e"},
      {"format", {"% #10x", Int64(-30)}, "     -0x1e"},
      {"format", {"% #10o", Int64(30)}, "       036"},
      {"format", {"% #10o", Int64(-30)}, "      -036"},
      {"format", {"%-+#10x", Int64(30)}, "+0x1e     "},
      {"format", {"%-+#10x", Int64(-30)}, "-0x1e     "},
      {"format", {"%-+#10o", Int64(30)}, "+036      "},
      {"format", {"%-+#10o", Int64(-30)}, "-036      "},
      {"format", {"%- #10x", Int64(30)}, " 0x1e     "},
      {"format", {"%- #10x", Int64(-30)}, "-0x1e     "},
      {"format", {"%- #10o", Int64(30)}, " 036      "},
      {"format", {"%- #10o", Int64(-30)}, "-036      "},
      {"format", {"%'+#9x", Int64(300000)}, "+0x4:93e0"},
      {"format", {"%'+#9x", Int64(-300000)}, "-0x4:93e0"},
      {"format", {"%'+#9o", Int64(300000)}, "+0111,1740"},
      {"format", {"%'+#9o", Int64(-300000)}, "-0111,1740"},
      {"format", {"%' #9x", Int64(300000)}, " 0x4:93e0"},
      {"format", {"%' #9x", Int64(-300000)}, "-0x4:93e0"},
      {"format", {"%' #9o", Int64(300000)}, " 0111,1740"},
      {"format", {"%' #9o", Int64(-300000)}, "-0111,1740"},
      // Repeats the block above without negative cases for unsigned types.
      {"format", {"%+x", Uint32(30)}, "+1e"},
      {"format", {"%+x", Uint64(30)}, "+1e"},
      {"format", {"% x", Uint32(30)}, " 1e"},
      {"format", {"% x", Uint64(30)}, " 1e"},
      {"format", {"%+#x", Uint64(30)}, "+0x1e"},
      {"format", {"% #x", Uint64(30)}, " 0x1e"},
      {"format", {"%+#X", Uint64(30)}, "+0X1E"},
      {"format", {"% #X", Uint64(30)}, " 0X1E"},
      {"format", {"%+o", Uint32(30)}, "+36"},
      {"format", {"%+o", Uint64(30)}, "+36"},
      {"format", {"% o", Uint32(30)}, " 36"},
      {"format", {"% o", Uint64(30)}, " 36"},
      {"format", {"%+#o", Uint64(30)}, "+036"},
      {"format", {"% #o", Uint64(30)}, " 036"},
      {"format", {"%+#10x", Uint64(30)}, "     +0x1e"},
      {"format", {"%+#10o", Uint64(30)}, "      +036"},
      {"format", {"% #10x", Uint64(30)}, "      0x1e"},
      {"format", {"% #10o", Uint64(30)}, "       036"},
      {"format", {"%-+#10x", Uint64(30)}, "+0x1e     "},
      {"format", {"%-+#10o", Uint64(30)}, "+036      "},
      {"format", {"%- #10x", Uint64(30)}, " 0x1e     "},
      {"format", {"%- #10o", Uint64(30)}, " 036      "},
      {"format", {"%'+#9x", Uint64(300000)}, "+0x4:93e0"},
      {"format", {"%'+#9o", Uint64(300000)}, "+0111,1740"},
      {"format", {"%' #9x", Uint64(300000)}, " 0x4:93e0"},
      {"format", {"%' #9o", Uint64(300000)}, " 0111,1740"},

      // Width/precision overflows an int32_t.
      {"format", {"%100000000000000000f", 1.5}, NullString(), OUT_OF_RANGE},
      {"format",
       {"%*e", Int64(100000000000000000), 1.5},
       NullString(),
       OUT_OF_RANGE},
      {"format", {"%.100000000000000000f", 1.5}, NullString(), OUT_OF_RANGE},
      {"format",
       {"%.*e", Int64(100000000000000000), 1.5},
       NullString(),
       OUT_OF_RANGE},
  });
}

}  // namespace zetasql
